home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume24 / chemtab / part02 < prev    next >
Encoding:
Internet Message Format  |  1991-03-12  |  53.8 KB

  1. Subject:  v24i037:  Manipulate data on the chemical elements, Part02/03
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: 1cd29b78 54235680 22a2972c e451314f
  5.  
  6. Submitted-by: "J.E. King" <jek5036@ultb.isc.rit.edu>
  7. Posting-number: Volume 24, Issue 37
  8. Archive-name: chemtab/part02
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # Contents:  Makefile VERSION chemtab.1 cleanup.c element.c element.h
  17. #   element2.c graph.h graphlib.c online_help pertab pertab_graphic
  18. #   ptabl.c schar.c scrmisc.c tune.h variables.h vdata.c
  19. # Wrapped by rsalz@litchi.bbn.com on Wed Mar 13 13:55:19 1991
  20. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  21. echo If this archive is complete, you will see the following message:
  22. echo '          "shar: End of archive 2 (of 3)."'
  23. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'Makefile'\"
  25. else
  26.   echo shar: Extracting \"'Makefile'\" \(1780 characters\)
  27.   sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  28. XCC            = cc
  29. XCFLAGS        = -g -DReGIS
  30. X# Define ReGIS if you want to program to prompt the user to answer y/n
  31. X# to the question of if they have a ReGIS compatible terminal
  32. XDEST          = chemtab
  33. XEXTHDRS          = /usr/include/curses.h \
  34. X        /usr/include/math.h \
  35. X        /usr/include/sgtty.h \
  36. X        /usr/include/signal.h \
  37. X        /usr/include/stdio.h \
  38. X        /usr/include/sys/ioctl.h \
  39. X        /usr/include/sys/ttychars.h \
  40. X        /usr/include/sys/ttydev.h \
  41. X        /usr/include/sys/ttyio.h \
  42. X        /usr/include/time.h
  43. XHDRS          = element.h \
  44. X        graph.h \
  45. X        tune.h \
  46. X        undefs.h \
  47. X        variables.h \
  48. X        windows.h
  49. XLDFLAGS          = $(CFLAGS)
  50. XLIBS          = -lcurses -ltermcap graphlib.a
  51. XLINKER          = cc
  52. XMAKEFILE      = Makefile
  53. XOBJS          = cleanup.o \
  54. X        dogph.o \
  55. X        doregisgph.o \
  56. X        element.o \
  57. X        element2.o \
  58. X        esort.o \
  59. X        looke.o \
  60. X        main.o \
  61. X        ptabl.o \
  62. X        schar.o \
  63. X        scrmisc.o \
  64. X        vdata.o
  65. XPRINT          = lpr
  66. XPROGRAM          = chemtab
  67. XSRCS          = cleanup.c \
  68. X        dogph.c \
  69. X        doregisgph.c \
  70. X        element.c \
  71. X        element2.c \
  72. X        esort.c \
  73. X        graphlib.c \
  74. X        looke.c \
  75. X        main.c \
  76. X        ptabl.c \
  77. X        schar.c \
  78. X        scrmisc.c \
  79. X        vdata.c
  80. X
  81. Xall:        grlib $(PROGRAM)
  82. X
  83. Xgrlib:        graphlib.o
  84. X        ar cr graphlib.a graphlib.o
  85. X        ranlib graphlib.a
  86. X
  87. X$(PROGRAM):     $(OBJS) graphlib.a
  88. X        @echo -n "Loading $(PROGRAM) ... "
  89. X        @$(LINKER) $(LDFLAGS) $(OBJS) -o $(PROGRAM) $(LIBS)
  90. X        @echo "done"
  91. X
  92. Xclean:;        @rm -f $(OBJS)
  93. X
  94. Xdepend:;    @mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)
  95. X
  96. Xindex:;        @ctags -wx $(HDRS) $(SRCS)
  97. X
  98. Xinstall:    $(PROGRAM)
  99. X        @echo Installing $(PROGRAM) in $(DEST)
  100. X        @install -m 4755 $(PROGRAM) $(DEST)
  101. X
  102. Xprint:;        @$(PRINT) $(HDRS) $(SRCS)
  103. X
  104. Xprogram:        $(PROGRAM)
  105. X
  106. Xtags:           $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
  107. X
  108. Xupdate:        $(DEST)/$(PROGRAM)
  109. X
  110. X$(DEST)/$(PROGRAM): $(SRCS) $(LIBS) $(HDRS) $(EXTHDRS)
  111. X        @make -f $(MAKEFILE) DEST=$(DEST) 
  112. X###
  113. END_OF_FILE
  114.   if test 1780 -ne `wc -c <'Makefile'`; then
  115.     echo shar: \"'Makefile'\" unpacked with wrong size!
  116.   fi
  117.   # end of 'Makefile'
  118. fi
  119. if test -f 'VERSION' -a "${1}" != "-c" ; then 
  120.   echo shar: Will not clobber existing file \"'VERSION'\"
  121. else
  122.   echo shar: Extracting \"'VERSION'\" \(1005 characters\)
  123.   sed "s/^X//" >'VERSION' <<'END_OF_FILE'
  124. XCurrently, you have Chemtab Version 2.01, Patchlevel 1.
  125. X
  126. XVersion History:
  127. X
  128. X    Chemtab V1.0    Selection and sorting algorithms, menu-bar
  129. X            driven display, slow and tedious.
  130. X
  131. X    Chemtab V1.1    Menu bar converted to keyboard selection by
  132. X            letter or number, faster, rewrote sorting
  133. X            algorithm, 5X faster.
  134. X
  135. X    Chemtab V1.2    Implementation of looking at a specific
  136. X            element and the graphing module was installed.
  137. X
  138. X    Chemtab V2.0    ReGIS interface made available to users for
  139. X            the graphing module, vt100 graphics set
  140. X            implemented for the periodic table.  Plotter
  141. X            capabilities installed for graphing module
  142. X            to plot on DEC LVP16 and possibly any HP..
  143. X            Minor screen glitches fixed. 
  144. X
  145. X    Chemtab V2.01    Added escape to main menu from all menus, changed
  146. X            looke.c to turn all lines into lowercase for 'look
  147. X            for element by name i.e. TECHnetIUM = technetium'.
  148. X            Online help implemented.
  149. X            Job stopping fixed. (BSD only)
  150. X            Pipe of ReGIS graphing commands into a file.
  151. X            Graphing module updated to work faster.
  152. END_OF_FILE
  153.   if test 1005 -ne `wc -c <'VERSION'`; then
  154.     echo shar: \"'VERSION'\" unpacked with wrong size!
  155.   fi
  156.   # end of 'VERSION'
  157. fi
  158. if test -f 'chemtab.1' -a "${1}" != "-c" ; then 
  159.   echo shar: Will not clobber existing file \"'chemtab.1'\"
  160. else
  161.   echo shar: Extracting \"'chemtab.1'\" \(1904 characters\)
  162.   sed "s/^X//" >'chemtab.1' <<'END_OF_FILE'
  163. X.TH chemtab 1
  164. X.SH NAME
  165. Xchemtab \- a database utility for the elements
  166. X.SH SYNTAX
  167. X.B chemtab
  168. X[
  169. X.I \-r
  170. X]
  171. X.SH DESCRIPTION
  172. XThe
  173. X.PN chemtab
  174. Xprogram is a utility which will allow you to manipulate data concerning
  175. Xthe elements.  The program was written to teach students entering a chemistry
  176. Xcourse for the first time to make connections between the elements
  177. Xcharacteristics and establish pattern recognition in the Periodic Table.
  178. XChemtab was written by a student for students, however the program does not
  179. Xnecessarily have to be for students only.  Chemtab contains a wide variety of
  180. Xinformation regarding all the elements and I hope it proves useful to you.
  181. X.SH FLAGS
  182. XIf you are using a Digital ReGIS compatible terminal, and you specify the
  183. X\-r flag, this will activate the ReGIS graphing routines.  If you wish to
  184. Xswitch between ReGIS and non-ReGIS while inside the program, there is a
  185. XReGIS indicator on the MAIN MENU screen.  Commands are available to switch
  186. Xbetween modes from the MAIN MENU.
  187. X.SH ONLINE HELP
  188. XThe database has a full online help utility.  At (most) any time you may type a
  189. Xquestion mark (?) and the program will give you information about the
  190. Xmenu choices.  Basically, since there is online help, there are no more
  191. Xmanual pages for chemtab.
  192. X.SH AUTHOR
  193. XJim King, Lincoln-Sudbury Regional High School AND
  194. XRochecter Institute of Technology
  195. XContact me at jek5036@ultb.isc.rit.edu.
  196. X.SH BUG REPORTS
  197. XPlease send all bug reports to the above internet address.  If it is a 
  198. Xsimple bug, like a screen glitch, explain where.  If it is more complex,
  199. Xindicate what you did to make this bug appear.
  200. X.SH KNOWN GLITCHES
  201. XThis program may have a hard time on a System V system.  Some include files
  202. Xare different, etc.  If anyone converts chemtab to a SYSV format, please
  203. Xsend me the diffs or the program back with the modifications.  I will then
  204. Xmake a SYSV compile-time definition so everyone can use it.
  205. END_OF_FILE
  206.   if test 1904 -ne `wc -c <'chemtab.1'`; then
  207.     echo shar: \"'chemtab.1'\" unpacked with wrong size!
  208.   fi
  209.   # end of 'chemtab.1'
  210. fi
  211. if test -f 'cleanup.c' -a "${1}" != "-c" ; then 
  212.   echo shar: Will not clobber existing file \"'cleanup.c'\"
  213. else
  214.   echo shar: Extracting \"'cleanup.c'\" \(2542 characters\)
  215.   sed "s/^X//" >'cleanup.c' <<'END_OF_FILE'
  216. X/*
  217. X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
  218. X *
  219. X * cleanup.c    Cleanup (exit) routine
  220. X */
  221. X
  222. X#include <curses.h>
  223. X#include <stdio.h>
  224. X#include <signal.h>
  225. X#include "windows.h"
  226. X#include "variables.h"
  227. X#include "tune.h"
  228. X
  229. X/*
  230. X * cleanup() - no input
  231. X *
  232. X * purpose:  Handle any quit or ^C signal nicely.
  233. X */
  234. X
  235. Xcleanup()
  236. X{
  237. X    char    c, str[80];            /* input */
  238. X#ifdef    PRINTQ
  239. X    char    que[80];            /* print queue */
  240. X#endif    PRINTQ
  241. X
  242. X#ifdef    ReGIS
  243. X    if (regis) endregis();
  244. X#endif    ReGIS
  245. X    if (trans) {                /* transcript flag */
  246. Xl1:        mvwaddstr(btm, 0, 0, "Would you like your transcript printed out? ");
  247. X        wrefresh(btm);
  248. X        cur = btm;
  249. X        xp = 44; yp = 0;
  250. X        noecho();
  251. X        crmode();
  252. X        c = getchar();
  253. X        if (c == 'n') {
  254. X            wclear(btm);
  255. X            wrefresh(btm);
  256. X        } else if (c == '?') {
  257. X            help(1);
  258. X            goto l1;
  259. X        } else {            /* else print it out */
  260. X            wprintw(btm, "yes");
  261. X            wrefresh(btm);
  262. X            echo(); nocrmode();
  263. X#ifdef    PRINTQ
  264. X            wclear(btm);
  265. X            mvwaddstr(btm, 0, 0, "Queue to print to: ");
  266. X            wrefresh(btm);
  267. X            cur = btm; xp = 21; yp = 0;
  268. X            gets(que);
  269. X            sprintf(str, "%s%s %d.chemtab", PRINTER, que, getpid());
  270. X#else    PRINTQ
  271. X            sprintf(str, "%s %d.chemtab", PRINTER, getpid());
  272. X#endif    PRINTQ
  273. X            fclose(fp);
  274. X            wclear(btm);
  275. X            wrefresh(btm);
  276. X            clear(); refresh();
  277. X            system(str);
  278. X        }
  279. X    }
  280. X    fclose(fp);                /* close things up */
  281. X    echo();
  282. X    nocrmode();
  283. X    clear(); refresh();
  284. X    endwin();                /* turn off curses */
  285. X    if (trans) {
  286. X        printf("A copy of your transcript can be found in the file %d.chemtab\n", getpid());
  287. X    /*    printf("\nYou can pick up your printout at the printer to the left of\n");
  288. X        printf("The White-Board, labelled Happy.  Look for your last name in >><<'s on\n");
  289. X        printf("the top line of each printout.  Good luck with Chemistry.\n");
  290. X     */ }
  291. X    fflush(stdout);                /* just make sure.. */
  292. X    exit(1);                /* quit nicely */
  293. X}
  294. X
  295. X#ifdef    USERSHELL
  296. Xstop()    /* Handle a ^Z */
  297. X{
  298. X    char    sh[80];
  299. X
  300. X    strcpy(sh, getenv("SHELL"));
  301. X    if (!strlen(sh))
  302. X        strcpy(sh, USERSHELL);
  303. X#ifdef    ReGIS
  304. X    if (regis) endregis();
  305. X#endif  ReGIS
  306. X    clear(); refresh();
  307. X    signal(SIGTSTP, SIG_DFL);
  308. X    printf("Type 'exit' to return to chemtab...\n");
  309. X    system(sh);
  310. X    clear(); refresh();
  311. X    signal(SIGTSTP, stop);
  312. X    if (needsit(stdscr)) { touchwin(stdscr); wrefresh(stdscr); }
  313. X    if (needsit(graph)) { touchwin(graph); wrefresh(graph); }
  314. X    if (needsit(mn)) { touchwin(mn); wrefresh(mn); }
  315. X    if (needsit(srt)) { touchwin(srt); wrefresh(srt); }
  316. X    if (needsit(btm)) { touchwin(btm); wrefresh(btm); }
  317. X    if (hlp != NULL) { touchwin(hlp); wrefresh(hlp); }
  318. X    wmove(cur, yp, xp);
  319. X    wrefresh(mn);
  320. X    crmode();
  321. X}
  322. X#endif    USERSHELL
  323. END_OF_FILE
  324.   if test 2542 -ne `wc -c <'cleanup.c'`; then
  325.     echo shar: \"'cleanup.c'\" unpacked with wrong size!
  326.   fi
  327.   # end of 'cleanup.c'
  328. fi
  329. if test -f 'element.c' -a "${1}" != "-c" ; then 
  330.   echo shar: Will not clobber existing file \"'element.c'\"
  331. else
  332.   echo shar: Extracting \"'element.c'\" \(2273 characters\)
  333.   sed "s/^X//" >'element.c' <<'END_OF_FILE'
  334. X/*
  335. X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
  336. X *
  337. X * element.c    Reads in the file from the #define PERTABLE (which is the
  338. X *        data file) and sorts into the structure elem (e).
  339. X *              Also reads in the close values (at the end)
  340. X */
  341. X
  342. X#include "variables.h"
  343. X#include "element.h"
  344. X#include "tune.h"
  345. X#include <stdio.h>
  346. X
  347. Xfloat closev[15];
  348. X
  349. X/*
  350. X * readelem() - no input
  351. X *
  352. X * purpose:    Take a line from PERTABLE (tune.h) and put it in structure
  353. X *        e which is defined as the element table used throughout
  354. X *        the program.  This was designed so the operator could easily
  355. X *        change an element or add one without changing anything but
  356. X *        tune.h
  357. X */
  358. Xreadelem()
  359. X{
  360. X    int    first = 1;
  361. X    char    inp[160];
  362. X    FILE    *fptr;                /* File pointer for PERTABLE */
  363. X    struct    elem    *tmp, *old, *new;
  364. X
  365. X    fptr = fopen(PERTABLE, "r");
  366. X
  367. X    fgets(inp, 160, fptr);            /* Read in comment line */
  368. X    fgets(inp, 160, fptr);            /* Eat the spacer */
  369. X
  370. X    tmp = NEW(elem);
  371. X    e = tmp;
  372. X    while (fscanf(fptr, "%s %s %d %f %d %d %d %d %d %d %d %f %f %f %f\n",
  373. X               tmp->name, tmp->sym, &tmp->anum, &tmp->amass, &tmp->fam,
  374. X               &tmp->row, &tmp->val, &tmp->melt, &tmp->boil,
  375. X               &tmp->fio, &tmp->year, &tmp->eneg, &tmp->spht,
  376. X               &tmp->dens, &tmp->arad) != EOF) {
  377. X            if (first) { first = 0; tmp = NEW(elem); continue; }
  378. X            if (tmp->anum < e->anum) {
  379. X                tmp->next = e;
  380. X                e = tmp;
  381. X                tmp = NEW(elem);
  382. X                continue;
  383. X            }
  384. X            old = NULL; new = e;
  385. X            for (;;) {
  386. X                if (new->next == NULL) { /* new tail */
  387. X                    new->next = tmp;
  388. X                    tmp->next = NULL;
  389. X                    break;
  390. X                }
  391. X                old = new;
  392. X                new = new->next;
  393. X                if ((old->anum < tmp->anum) &&
  394. X                   (tmp->anum < new->anum)) {
  395. X                    tmp->next = new;
  396. X                    old->next = tmp;
  397. X                    break;
  398. X                }
  399. X            }
  400. X        tmp = NEW(elem);
  401. X    }
  402. X    tmp = NULL;
  403. X    fclose(fptr);                /* Be nice and neat */
  404. X}
  405. X
  406. X/*
  407. X * getclose()
  408. X * inputs: none
  409. X * returns: 888 if bad closefile
  410. X * purpose: read close values from CLOSEFILE
  411. X */
  412. Xint getclose()
  413. X{
  414. X    FILE    *fp;
  415. X    char    str[90];
  416. X    int    i;
  417. X
  418. X    if ((fp = fopen(CLOSEFILE, "r")) == NULL) {
  419. X        printf("chemtab: Make sure that tune.h reflects all file names. (CLOSEFILE)\n");
  420. X        exit(1);
  421. X    }
  422. X
  423. X    fgets(str, 90, fp); fgets(str, 90, fp);
  424. X
  425. X    for (i = 0; i < 15; i++)
  426. X        if (fscanf(fp, "%s%c%f\n", str, str, &closev[i]) == EOF) return(888);
  427. X    
  428. X    fclose(fp);
  429. X}
  430. X
  431. END_OF_FILE
  432.   if test 2273 -ne `wc -c <'element.c'`; then
  433.     echo shar: \"'element.c'\" unpacked with wrong size!
  434.   fi
  435.   # end of 'element.c'
  436. fi
  437. if test -f 'element.h' -a "${1}" != "-c" ; then 
  438.   echo shar: Will not clobber existing file \"'element.h'\"
  439. else
  440.   echo shar: Extracting \"'element.h'\" \(797 characters\)
  441.   sed "s/^X//" >'element.h' <<'END_OF_FILE'
  442. X/*
  443. X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
  444. X *
  445. X * element.h    Contains the structure for all the elements, *e.
  446. X */
  447. X
  448. X#include "tune.h"
  449. X
  450. X#define    NEW(X)    (struct X *)malloc(sizeof(struct X))
  451. X
  452. Xstruct elem {
  453. X    char    name[18],        /* Atomic Name */
  454. X        sym[4];            /* Atomic Symbol */
  455. X    float    amass,            /* Atomic Mass */
  456. X        eneg,            /* Electronegativity */
  457. X        spht,            /* Specific Heat */
  458. X        arad,            /* Atomic Radius */
  459. X        dens;            /* Density of the Solid */
  460. X    int    anum,            /* Atomic Number */
  461. X        melt,            /* Melting point, deg C */
  462. X        boil,            /* Boiling point, deg C */
  463. X        fio,            /* First Ionization Energy, cal */
  464. X        year,            /* Year Discovered */
  465. X        val,            /* Valence Electrons */
  466. X        fam,            /* Family (1-18, new system) */
  467. X        row;            /* Horizontal rows */
  468. X    struct    elem    *next;        /* linked list */
  469. X} *e;
  470. END_OF_FILE
  471.   if test 797 -ne `wc -c <'element.h'`; then
  472.     echo shar: \"'element.h'\" unpacked with wrong size!
  473.   fi
  474.   # end of 'element.h'
  475. fi
  476. if test -f 'element2.c' -a "${1}" != "-c" ; then 
  477.   echo shar: Will not clobber existing file \"'element2.c'\"
  478. else
  479.   echo shar: Extracting \"'element2.c'\" \(1235 characters\)
  480.   sed "s/^X//" >'element2.c' <<'END_OF_FILE'
  481. X/*
  482. X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
  483. X *
  484. X * element2.c    Reads in the file from the #define BINTABLE (which is the
  485. X *        data file) and sorts into the structure stat (e).
  486. X */
  487. X
  488. X#include "tune.h"
  489. X#include "variables.h"
  490. X#include <stdio.h>
  491. X#include "element.h"
  492. X
  493. X/*
  494. X * binreadelem() - no input
  495. X *
  496. X * purpose:    Take a line from BINTABLE (tune.h) and put it in structure
  497. X *        e which is defined as the element table used throughout
  498. X *        the program.  This was designed so the operator could easily
  499. X *        change an element or add one without changing anything but
  500. X *        tune.h
  501. X */
  502. Xbinreadelem()
  503. X{
  504. X    FILE    *fptr;                /* File pointer for PERTABLE */
  505. X    struct    elem    *tmp, *old, *new;
  506. X
  507. X    if ((fptr = fopen(BINTABLE, "r")) == NULL) /* Open it please */
  508. X        return(888);
  509. X
  510. X    e = NEW(elem);
  511. X    tmp = e;
  512. X    while (fread(tmp, sizeof(struct elem), 1, fptr) == 1) {
  513. X        tmp->next = NEW(elem);
  514. X        tmp = tmp->next;
  515. X    }
  516. X    tmp = NULL;
  517. X    fclose(fptr);                /* Be nice and neat */
  518. X}
  519. X
  520. Xbinwritelem()
  521. X{
  522. X    FILE    *fptr;
  523. X    struct    elem    *tmp;
  524. X
  525. X    tmp = e;
  526. X    if ((fptr = fopen(BINTABLE, "w")) == NULL) return(888);
  527. X
  528. X    for (tmp = e; tmp != NULL; tmp = tmp->next) {
  529. X        if (fwrite(tmp, sizeof(struct elem), 1, fptr) != 1)
  530. X            return(888);
  531. X        fflush(fptr);
  532. X    }
  533. X
  534. X    fclose(fptr);
  535. X}
  536. END_OF_FILE
  537.   if test 1235 -ne `wc -c <'element2.c'`; then
  538.     echo shar: \"'element2.c'\" unpacked with wrong size!
  539.   fi
  540.   # end of 'element2.c'
  541. fi
  542. if test -f 'graph.h' -a "${1}" != "-c" ; then 
  543.   echo shar: Will not clobber existing file \"'graph.h'\"
  544. else
  545.   echo shar: Extracting \"'graph.h'\" \(1463 characters\)
  546.   sed "s/^X//" >'graph.h' <<'END_OF_FILE'
  547. X/*
  548. X * chemtab - a periodic table data base (C) 1990 by Jim King (pulsar@lsrhs)
  549. X *
  550. X * graph.h    Contains stuff for graphing
  551. X */
  552. X
  553. X/* NOTE: All regis drawing code runs off these numbers
  554. X *       XMAXDEF = 798 - XBOUND
  555. X *       YMAXDEF = 478 - YBOUND
  556. X *       XAXISDEF = XMAXDEF - XBOUND
  557. X *       YAXISDEF = YMAXDEF - YBOUND
  558. X *
  559. X * for some reason these wouldn't work just as defines.. probably a
  560. X * memory or program counter error.
  561. X */
  562. X#ifdef    ReGIS
  563. X#define    XBOUND    100
  564. X#define    YBOUND    50
  565. X
  566. X#define    XMINDEF    XBOUND
  567. X#define XMAXDEF    693
  568. X#define YMINDEF    YBOUND
  569. X#define YMAXDEF    428
  570. X
  571. X#define XAXISDEF 593
  572. X#define YAXISDEF 378
  573. X
  574. X/* VT2XX ReGIS colors */
  575. X#define RED_2    7
  576. X#define GRN_2    6
  577. X#define BLU_2    5
  578. X#define BLK_2    4
  579. X
  580. X/* VT3XX ReGIS colors */
  581. X#define WHT_3    7
  582. X#define YEL_3    6
  583. X#define CYA_3    5
  584. X#define MAG_3    4
  585. X#define GRN_3    3
  586. X#define RED_3    2
  587. X#define BLU_3    1
  588. X#define BLK_3    0
  589. X#endif    ReGIS
  590. X
  591. Xdouble    xmax,        /* X axis maximum value */
  592. X    xmin,        /* X axis minimum value */
  593. X    ymax,        /* Y axis maximum value */
  594. X    ymin,        /* Y axis minimum value */
  595. X    scale,        /* used to determine spots */
  596. X    xaxis[800],
  597. X    yaxis[400];
  598. Xchar    c1,        /* letter of choice, x axis */
  599. X    c2;        /* letter of choice, y axis */
  600. Xint    xspot,        /* x axis line to plot on */
  601. X    yspot;        /* y axis line to plot on */
  602. X
  603. Xstatic char    *gname[] = {    /* Top line, 'x' vs. 'y' */
  604. X    0,"Atomic Number","Atomic Mass","Melting Temp.","Boiling Temp.",
  605. X    "Ionization energy","Electronegativity","Specific Heat",
  606. X    "Density","Atomic Radius","Discovery Year",0
  607. X};
  608. END_OF_FILE
  609.   if test 1463 -ne `wc -c <'graph.h'`; then
  610.     echo shar: \"'graph.h'\" unpacked with wrong size!
  611.   fi
  612.   # end of 'graph.h'
  613. fi
  614. if test -f 'graphlib.c' -a "${1}" != "-c" ; then 
  615.   echo shar: Will not clobber existing file \"'graphlib.c'\"
  616. else
  617.   echo shar: Extracting \"'graphlib.c'\" \(2302 characters\)
  618.   sed "s/^X//" >'graphlib.c' <<'END_OF_FILE'
  619. X#ifdef    ReGIS
  620. X
  621. X#include <stdio.h>
  622. X#include <curses.h>
  623. X#include <strings.h>
  624. X#include "variables.h"
  625. X#include "element.h"
  626. X#include "graph.h"
  627. X#include "undefs.h"
  628. X#include "tune.h"
  629. X
  630. X/*
  631. X * ReGIS graphics interface package (NOTE: Not curses oriented)
  632. X */
  633. X
  634. Xchcolor(col)
  635. Xint    col;
  636. X{
  637. X    if (!strncmp(getenv("TERM"), "vt2", 3)) {
  638. X        switch(col) {
  639. X            case '7':
  640. X            case '2':
  641. X            case '4':
  642. X                col = RED_2;
  643. X                break;
  644. X            case '1':
  645. X            case '5':
  646. X                col = BLU_2;
  647. X                break;
  648. X            case '0': col = BLK_2; break;
  649. X            default:
  650. X                col = GRN_2;
  651. X                break;
  652. X        }
  653. X    }
  654. X    printf("W(I%d)", col);
  655. X}
  656. X
  657. Xinitregis()
  658. X{
  659. X    printf("\033Pp");
  660. X#ifdef    LASERPRT
  661. X    if (laser)
  662. X        fprintf(lsr, "\033Pp");
  663. X#endif    LASERPRT
  664. X    chcolor(6);
  665. X}
  666. X
  667. Xendregis()
  668. X{
  669. X#ifdef    LASERPRT
  670. X    if (laser)
  671. X        fprintf(lsr, "\033\\");
  672. X#endif    LASERPRT
  673. X    printf("\033\\"); 
  674. X}
  675. X
  676. Xregisgoto(x, y)
  677. Xint    x, y;
  678. X{
  679. X#ifdef    LASERPRT
  680. X    if (laser)
  681. X        fprintf(lsr, "P[%d,%d]", x, y);
  682. X#endif    LASERPRT
  683. X    printf("P[%d,%d]", x, y);
  684. X}
  685. X
  686. Xline(x1, y1, x2, y2)
  687. Xint    x1, y1, x2, y2;    /* From x1,y1 to x2,y2 */
  688. X{
  689. X    regisgoto(x1, y1);
  690. X    printf("V[%d,%d]", x2, y2);
  691. X#ifdef    LASERPRT
  692. X    if (laser)
  693. X        fprintf(lsr, "V[%d,%d]", x2, y2);
  694. X#endif    LASERPRT
  695. X    }
  696. X
  697. Xmybox(width, x1, y1, x2, y2)
  698. Xint    width, x1, y1, x2, y2;
  699. X{
  700. X    int    i;
  701. X    for (i = 0; i <= width; i++) {
  702. X        line(x1+i, y1+i, x2-i, y1+i);
  703. X        line(x2-i, y1+i, x2-i, y2-i);
  704. X        line(x2-i, y2-i, x1+i, y2-i);
  705. X        line(x1+i, y2-i, x1+i, y1+i);
  706. X    }
  707. X}
  708. X
  709. Xhash(x1, y1, which)
  710. Xint    x1, y1, which;        /* Make small hashmark with cross at x1,y1 */
  711. X{
  712. X    if (which) {
  713. X        regisgoto(x1, y1);  /* decided to make it a circle... */
  714. X        printf("W(S1)C[+2]W(S0)");
  715. X        fflush(stdout);
  716. X#ifdef    LASERPRT
  717. X        if (laser)
  718. X            fprintf(lsr, "W(S1)C[+2]W(S0)");
  719. X#endif    LASERPRT
  720. X    } else {
  721. X        line(x1, y1-2, x1, y1+2);
  722. X        line(x1-2, y1, x1+2, y1);
  723. X    }
  724. X}
  725. X
  726. Xtext(size, dir, angle, string)
  727. Xint    size,        /* 0 through 16 * multiplier of # pixels in char */
  728. X    dir,        /* Angle of text in 45 degree increments */
  729. X    angle;        /* italics angle -45 to 45 degrees */
  730. Xchar    *string;    /* text to output */
  731. X{
  732. X    printf("T(D%d)(S%d)(D%d)(I%d)'%s'", dir, size, dir, angle, string);
  733. X#ifdef    LASERPRT
  734. X    if (laser)
  735. X        fprintf(lsr, "T(D%d)(S%d)(D%d)(I%d)'%s'", dir, size, dir, angle, string);
  736. X#endif    LASERPRT
  737. X}
  738. X
  739. Xregispc()
  740. X{
  741. X    noecho(); crmode();
  742. X    regisgoto(10, 455);
  743. X    text(1, 0, -5, "Press SPACE to continue...");
  744. X    fflush(stdout);
  745. X    getchar();
  746. X    echo(); nocrmode();
  747. X}
  748. X#endif    ReGIS
  749. END_OF_FILE
  750.   if test 2302 -ne `wc -c <'graphlib.c'`; then
  751.     echo shar: \"'graphlib.c'\" unpacked with wrong size!
  752.   fi
  753.   # end of 'graphlib.c'
  754. fi
  755. if test -f 'online_help' -a "${1}" != "-c" ; then 
  756.   echo shar: Will not clobber existing file \"'online_help'\"
  757. else
  758.   echo shar: Extracting \"'online_help'\" \(4315 characters\)
  759.   sed "s/^X//" >'online_help' <<'END_OF_FILE'
  760. X_
  761. X    Before ending your session, you may choose to print
  762. Xout all of your recorded transcripts.  If you type 'y', the
  763. Xprogram will send your transcript to an appropriate printer
  764. XIn either case, the transcript will be saved in a file
  765. Xwith the format XXX.chemtab where XXX is the process ID
  766. Xof your current session.
  767. X_
  768. X    Since you have selected some elements within
  769. Xcertain boundaries, now you may choose whether or not you
  770. Xwish to use all the elements or these special elements
  771. Xwhen plotting on the graph.  Type 'a' for the special
  772. Xelements, or 'b' for all the elements.
  773. X_
  774. X    In order to graph, each axis must have a
  775. Xdefinition.  If you want to compare electronegativity to
  776. Xatomic number, it is easier to see the pattern if atomic
  777. Xnumber is on the x-axis, (which is also the wider axis
  778. Xwith 69 [or 600 with ReGIS].)
  779. X_
  780. X    The x-axis is special because it is the scale for
  781. Xwhat you view.  You can change this scale to be whatever
  782. Xyou wish.  If you only want to look at elements with an
  783. Xatomic number between 50 and 60, you can select atomic
  784. Xnumber for your x-axis and enter 50 for the x-axis
  785. Xminimum value, and 60 for the maximum.
  786. X_
  787. X    In order to graph, both axes must have a
  788. Xdefinition.  The y-axis is important because this will be
  789. Xwhat you are comparing to.  You must choose one.  Example:
  790. XIf you choose atomic number for both x- and y-axes, you
  791. Xshould get a straight line slanting /
  792. X_
  793. X    The ReGIS graphics can provide you with grid lines
  794. Xat the intervals marked on the screen.  This helps in
  795. Xdetermining a point's values on the graph far away from
  796. Xthe axes.
  797. X_
  798. X    Sometimes it is easier to see a pattern if the
  799. Xpoints are connected.  An example is atomic number vs.
  800. Xelectronegativity.  Try it and decide which you like
  801. Xmore.
  802. X_
  803. X    This is only for asthetics and speed.  The points
  804. Xlook nicer on the graph but they take longer because they
  805. Xare a 'graphic fill' which only means it takes more time
  806. Xfor the terminal to do the work than it would to make two
  807. Xlines.
  808. X_
  809. X    This is the first sub-menu.  Here you can choose
  810. Xwhich method you want to look for an element by.  Your
  811. Xchoices are name, number, or symbol.  Of course you can
  812. Xget back to the main menu by hitting '4'.
  813. X_
  814. X    Type in the full name, or part of a name of an
  815. Xelement.  If your choice is not ambiguous, ('i' would be
  816. Xambiguous, whereas 'hyd' would not) the computer will
  817. Xdisplay the information you request.
  818. X_
  819. X    Type in the atomic number of the element you
  820. Xare looking for.
  821. X_
  822. X    Type in the symbol of the element you are
  823. Xlooking for.  Remember that uppercase and lowercase
  824. Xcount here.
  825. X_
  826. X    The computer can keep a copy of all lists,
  827. Xgraphs (not ReGIS graphs), and tables (not VT100
  828. Xalternate set tables) which you make.  These will
  829. Xbe saved in a file in this account and you may
  830. Xhave the option to have this program print these
  831. Xout for you.
  832. X_
  833. X    Since there may be more than one person
  834. Xprinting out at a time, this program will put your
  835. Xname on the top of your transcript so you can tell
  836. Xwhich one is yours.
  837. X_
  838. X    This is the main menu.  From here you can
  839. Xdo several things.  '1' will let you choose to
  840. Xlook at one elements information.  '2' will allow
  841. Xyou to choose boundaries for the elements you wish
  842. Xto look at.  '3' will list these special elements.
  843. X'4' will show their position on the periodic table.
  844. X'5' will let you use the graphing module.
  845. X'6' will exit the program.  '^R' or Control-R
  846. X(hold down the control key and press R) will turn
  847. XReGIS mode on and off.  This affects the graphing
  848. Xportion of the pogram only.  Of course, '^C' will
  849. Xexit the program at any time.  '^V' shows all version
  850. Xdefinitions.
  851. X_
  852. X    For asthetics, the program can make the
  853. Xperiodic table look nice by using graphics.
  854. XOne drawback is that these graphics cannot be saved
  855. Xand printed.
  856. X_
  857. X    Here you should choose one characteristic
  858. Xto set.  Say, for example you want to see all
  859. Xelements with a melting temperature greater than
  860. X1000 celcius.  You would type in the number for
  861. Xmelting temperature here.
  862. X_
  863. X_
  864. X    The ReGIS commands can be printed on any DEC
  865. XLN03 compatible laserprinter, possibly others.  If
  866. Xyou want the program to save a copy of your graph
  867. Xin text form (usually about 5000 chars) type 'y'.
  868. XThe filename will be in the current directory under
  869. X'laser'.
  870. X_
  871. X    This determines how your search will be
  872. Xprocessed.
  873. X_
  874. X_
  875. X    You may choose whether or not you want this
  876. Xgraph, list, or table in your transcript.
  877. END_OF_FILE
  878.   if test 4315 -ne `wc -c <'online_help'`; then
  879.     echo shar: \"'online_help'\" unpacked with wrong size!
  880.   fi
  881.   # end of 'online_help'
  882. fi
  883. if test -f 'pertab' -a "${1}" != "-c" ; then 
  884.   echo shar: Will not clobber existing file \"'pertab'\"
  885. else
  886.   echo shar: Extracting \"'pertab'\" \(1256 characters\)
  887.   sed "s/^X//" >'pertab' <<'END_OF_FILE'
  888. X  1 <- 1a                                     8a -> 18
  889. X|--|2a    PERIODIC TABLE OF          3a 4a 5a 6a 7a|--|
  890. X|  | 2             THE ELEMENTS      13 14 15 16 17|  |1
  891. X|--|--|                             |--|--|--|--|--|--|
  892. X|  |  |                             |  |  |  |  |  |  |2
  893. X|--+--|1b 2b 3b 4b 5b 6b 7b 8b 9b Xb|--+--+--+--+--+--|
  894. X|  |  | 3  4  5  6  7  8  9 10 11 12|  |  |  |  |  |  |3
  895. X|--+--|--|--|--|--|--|--|--|--|--|--|--|--+--+--+--+--|
  896. X|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |4
  897. X|--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
  898. X|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |5
  899. X|--+--|--|--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
  900. X|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |6a (6)
  901. X|--+--|  |-----------+-----------+-----|--|--|--|--|--|
  902. X|  |  |  |   |   |   |   |   |   |   |7a (7)
  903. X|--|--|  |---|---|---|---|---|---|---|
  904. X            4   5   6   7   8   9  10  <- Unx family numbers
  905. X            |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|    v----^
  906. XLanthanides |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |6b (8)
  907. X            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
  908. X  Actinides |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |7b (9)
  909. X            |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|
  910. END_OF_FILE
  911.   if test 1256 -ne `wc -c <'pertab'`; then
  912.     echo shar: \"'pertab'\" unpacked with wrong size!
  913.   fi
  914.   # end of 'pertab'
  915. fi
  916. if test -f 'pertab_graphic' -a "${1}" != "-c" ; then 
  917.   echo shar: Will not clobber existing file \"'pertab_graphic'\"
  918. else
  919.   echo shar: Extracting \"'pertab_graphic'\" \(1246 characters\)
  920.   sed "s/^X//" >'pertab_graphic' <<'END_OF_FILE'
  921. X  1                                                 18
  922. Xlqqk      PERIODIC TABLE OF                        lqqk
  923. Xx  x 2             THE ELEMENTS      13 14 15 16 17x  x1
  924. Xtqqnqqk                             lqqwqqwqqwqqwqqnqqu
  925. Xx  x  x                             x  x  x  x  x  x  x2
  926. Xtqqnqqu                             tqqnqqnqqnqqnqqnqqu
  927. Xx  x  x 3  4  5  6  7  8  9 10 11 12x  x  x  x  x  x  x3
  928. Xtqqnqqnqqwqqwqqwqqwqqwqqwqqwqqwqqwqqnqqnqqnqqnqqnqqnqqu
  929. Xx  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x4
  930. Xtqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqu
  931. Xx  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x5
  932. Xtqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqu
  933. Xx  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x6A (6)
  934. Xtqqnqqu  tqqvwqvqwvqqnqqvwqvqwvqqnqqvwqvqqvqqvqqvqqvqqj
  935. Xx  x  x  x   x   x   x   x   x   x   x7A (7)
  936. Xmqqvqqj  mqqqvqqqvqqqvqqqvqqqvqqqvqqqj
  937. X            4   5   6   7   8   9  10  <- UNX FAMILY NUMBERS
  938. X            lqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqk
  939. XLANTHANIDES x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x6B (8)
  940. X            tqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqu
  941. X  ACTINIDES x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x7B (9)
  942. X            mqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqj
  943. END_OF_FILE
  944.   if test 1246 -ne `wc -c <'pertab_graphic'`; then
  945.     echo shar: \"'pertab_graphic'\" unpacked with wrong size!
  946.   fi
  947.   # end of 'pertab_graphic'
  948. fi
  949. if test -f 'ptabl.c' -a "${1}" != "-c" ; then 
  950.   echo shar: Will not clobber existing file \"'ptabl.c'\"
  951. else
  952.   echo shar: Extracting \"'ptabl.c'\" \(2877 characters\)
  953.   sed "s/^X//" >'ptabl.c' <<'END_OF_FILE'
  954. X/*
  955. X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
  956. X *
  957. X * ptabl.c    Print the Periodic Table with sorted elements in place
  958. X */
  959. X
  960. X#include <curses.h>
  961. X#include "windows.h"
  962. X#include <stdio.h>
  963. X#include "variables.h"
  964. X#include "tune.h"
  965. X#include "element.h"
  966. X#include <signal.h>
  967. X
  968. Xextern int    stop();
  969. X
  970. X/* helps to print out where the elements go */
  971. Xint    horz[10] = { 0, 2, 4, 6, 8, 10, 12, 14, 18, 20 };
  972. X
  973. X/*
  974. X * ptabl() - no input
  975. X *
  976. X * purpose:    To print the periodic table then fill in spaces with
  977. X *        appropriate ''selected'' elements.
  978. X */
  979. Xptabl()
  980. X{
  981. X    struct    elem    *tmp;
  982. X    FILE    *fd;        /* Periodic table is in a file */
  983. X    char    foo[80];    /* And we need to read it into something */
  984. X    int    z, i, n, ics;    /* element number reference */
  985. X
  986. X    if (gtot == -1) {
  987. X        mvwaddstr(mn, 15, 0, "Please choose some selection characteristics before you do this.");
  988. X        wrefresh(mn);
  989. X        sleep(2);
  990. X        wmove(mn, 15, 0); wclrtoeol(mn);
  991. X        return(0);
  992. X    }
  993. X
  994. X    strcpy(foo, TABLE);
  995. X
  996. X    wclear(mn); wrefresh(mn);
  997. X    clear(); refresh();
  998. Xl16:    mvwaddstr(btm, 0, 0, "VT100 alternate graphic set (if yes, no transcript of this table) ");
  999. X    wrefresh(btm);
  1000. X    cur = btm; xp = 65; yp = 0;
  1001. X    noecho(); crmode();
  1002. X    switch(getchar()) {
  1003. X        case '?': help(16); goto l16;
  1004. X        case 'y':
  1005. X        case 'Y':
  1006. X#ifdef    USERSHELL
  1007. X            signal(SIGTSTP, SIG_IGN);
  1008. X#endif    USERSHELL
  1009. X            strcat(foo, "_graphic"); ics = 1; break;
  1010. X        default: ics = 0; break;
  1011. X    }
  1012. X    if ((fd = fopen(foo, "r")) == NULL) {
  1013. X        bot("Cannot open periodic table.. sorry..");
  1014. X        sleep(3);
  1015. X        return(0);
  1016. X    }
  1017. X    if (ics) printf("\033(0");    /* on graphics */
  1018. X    for (i = 0; i < 22; i++) {    /* read in the table */
  1019. X        fgets(foo, 80, fd);
  1020. X        mvwaddstr(graph, i, 0, foo);
  1021. X        wrefresh(graph);
  1022. X    }                /* and output to WINDOW *graph */
  1023. X    fclose(fd);
  1024. X    if (ics) printf("\033(B");
  1025. X    tablsort();            /* Put characteristics on screen */
  1026. X    if (ics) printf("\033(0"); fflush(stdout);
  1027. X    for (i = 1; i < gtot+1; i++) {    /* format and print element sym. */
  1028. X        n = sub1[i];
  1029. X        for (tmp = e; n != tmp->anum; tmp = tmp->next) ;
  1030. X        if (tmp->anum > 56 && tmp->anum < 72)
  1031. X            wmove(graph, horz[8], (13 + ((tmp->fam - 1) * 3)));
  1032. X        else if (tmp->anum > 88 && tmp->anum < 104)
  1033. X            wmove(graph, horz[9], (13 + ((tmp->fam - 1) * 3)));
  1034. X        else if (tmp->anum > 103 && tmp->anum < 111)
  1035. X            wmove(graph, horz[tmp->row], (1 + ((tmp->fam - 1) * 3) - (104 - tmp->anum)));
  1036. X        else
  1037. X            wmove(graph, horz[tmp->row], (1 + ((tmp->fam - 1) * 3)));
  1038. X
  1039. X        wrefresh(graph);
  1040. X        wstandout(graph);
  1041. X        if (ics) {        /* I realize the slowness... */
  1042. X            printf("\033(B"); fflush(stdout);
  1043. X            wprintw(graph, "%2s", tmp->sym);
  1044. X            wrefresh(graph);
  1045. X            printf("\033(0"); fflush(stdout);
  1046. X        } else
  1047. X            wprintw(graph, "%2s", tmp->sym);
  1048. X        wrefresh(graph);
  1049. X        wstandend(graph);
  1050. X    }
  1051. X    if (ics) printf("\033(B");
  1052. X    wrefresh(graph);
  1053. X    if (!ics) capture(graph, 0, 0);
  1054. X    spc();
  1055. X    wclear(graph); wrefresh(graph);
  1056. X    clear();
  1057. X    refresh();
  1058. X#ifdef    USERSHELL
  1059. X    signal(SIGTSTP, stop);
  1060. X#endif    USERSHELL
  1061. X    return(0);
  1062. X}
  1063. END_OF_FILE
  1064.   if test 2877 -ne `wc -c <'ptabl.c'`; then
  1065.     echo shar: \"'ptabl.c'\" unpacked with wrong size!
  1066.   fi
  1067.   # end of 'ptabl.c'
  1068. fi
  1069. if test -f 'schar.c' -a "${1}" != "-c" ; then 
  1070.   echo shar: Will not clobber existing file \"'schar.c'\"
  1071. else
  1072.   echo shar: Extracting \"'schar.c'\" \(6207 characters\)
  1073.   sed "s/^X//" >'schar.c' <<'END_OF_FILE'
  1074. X/*
  1075. X * Chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
  1076. X *
  1077. X * schar.c    Interface with user for sorting
  1078. X */
  1079. X
  1080. X#include <stdio.h>
  1081. X#include <curses.h>
  1082. X#include "element.h"
  1083. X#include "variables.h"
  1084. X#include "windows.h"
  1085. X#include "tune.h"
  1086. X
  1087. Xextern float closev[];
  1088. X
  1089. X/*
  1090. X * whichone() - no input
  1091. X *
  1092. X * purpose:    to find out how many characteristics we are sorting already
  1093. X */
  1094. Xwhichone()
  1095. X{
  1096. X    if (dosort[2].wch != 0)
  1097. X        return(3);
  1098. X    if (dosort[1].wch != 0)
  1099. X        return(2);
  1100. X    if (dosort[0].wch != 0)
  1101. X        return(1);
  1102. X    return(0);
  1103. X}
  1104. X
  1105. X/*
  1106. X * tablsort() - no input
  1107. X *
  1108. X * purpose:    Put characteristics on table window
  1109. X */
  1110. Xtablsort()
  1111. X{
  1112. X    int    i;
  1113. X    
  1114. X    for (i = 0; i < 3; i++) {
  1115. X        if (dosort[i].wch != 0) {
  1116. X            wmove(graph, i*4, 57);
  1117. X            wstandout(graph);
  1118. X            wprintw(graph, "%s", sopts[dosort[i].wch].chst);
  1119. X            wstandend(graph);
  1120. X            switch(dosort[i].sgn) {
  1121. X                case EQUAL: mvwaddstr(graph, i*4+1, 58, "is Equal to"); break;
  1122. X                case GREATER: wmove(graph, i*4+1, 58); wprintw(graph, "is %s", sopts[dosort[i].wch].upline); break;
  1123. X                case CLOSE: mvwaddstr(graph, i*4+1, 58, "is Close to"); break;
  1124. X                default: wmove(graph, i*4+1, 58); wprintw(graph, "is %s", sopts[dosort[i].wch].dnline); break;
  1125. X            }
  1126. X            wmove(graph, i*4+2, 59);
  1127. X            wprintw(graph, "%4.*f", sopts[dosort[i].wch].dnum, dosort[i].amt);
  1128. X        }
  1129. X    }
  1130. X    wrefresh(graph);
  1131. X}
  1132. X
  1133. X/*
  1134. X * upsort() - no input
  1135. X *
  1136. X * purpose:    Update the sort window
  1137. X */
  1138. Xupsort()
  1139. X{
  1140. X    int    i;
  1141. X
  1142. X    wclear(srt);
  1143. X    mvwaddstr(srt, 0, 0, "Current selecting characteristics: (max of 3)");
  1144. X    for (i = 0; i < 3; i++) {
  1145. X        if (dosort[i].wch != 0) {
  1146. X            wmove(srt, i+2, 0);
  1147. X            wstandout(srt);
  1148. X            wprintw(srt, "%s", sopts[dosort[i].wch].chst);
  1149. X            wstandend(srt);
  1150. X            switch(dosort[i].sgn) {
  1151. X                case EQUAL: wprintw(srt, " is Equal to "); break;
  1152. X                case GREATER: wprintw(srt, " is %s ", sopts[dosort[i].wch].upline); break;
  1153. X                case LESS: wprintw(srt, " is %s ", sopts[dosort[i].wch].dnline); break;
  1154. X                case CLOSE: wprintw(srt, " is Close to "); break;
  1155. X            }
  1156. X            wprintw(srt, "%4.*f", sopts[dosort[i].wch].dnum, dosort[i].amt);
  1157. X        }
  1158. X    }
  1159. X    wrefresh(srt);
  1160. X}
  1161. X
  1162. X/*
  1163. X * schar() - no input
  1164. X *
  1165. X * purpose:    Interface with user to select sorting characteristics
  1166. X *        to sort elements from
  1167. X */
  1168. Xschar()
  1169. X{
  1170. X    char    str[50];
  1171. X    int    n, curn, i;
  1172. X
  1173. X    noecho();
  1174. X    crmode();
  1175. Xlop1:    clear(); refresh();
  1176. X    for (;;) {
  1177. Xlop2:        upsort();                /* Update sorts */
  1178. X        wclear(mn); wrefresh(mn);
  1179. X        menu("Select Elemental Characteristics");
  1180. X        for (i = 1; i < 8; i++) {
  1181. X            wmove(mn, i+1, 0);
  1182. X            wprintw(mn, "%d] %s", i, sopts[i].chst);
  1183. X            wmove(mn, i+1, 40);
  1184. X            wprintw(mn, "%d] %s", i+7, sopts[i+7].chst);
  1185. X        }
  1186. X        wmove(mn, 9, 40);
  1187. X        wprintw(mn, "15] %s", sopts[15].chst);
  1188. Xl17:        mvwaddstr(mn, 11, 0, "Your Choice [14]? ");
  1189. X        wclrtoeol(mn);
  1190. X        cur = mn; xp = 18; yp = 11;
  1191. X        mvwaddstr(mn, 11, 16, " ");
  1192. X        wrefresh(mn);
  1193. X        echo();
  1194. X        nocrmode();
  1195. X        gets(str);
  1196. X        if (str[0] == '?') { help(17); goto l17; }
  1197. X        if (!strlen(str)) n = 14; else n = atoi(str);
  1198. X        fixup(mn);
  1199. X        switch(n) {
  1200. X            case 14:        /* Main Menu */
  1201. X                esort();
  1202. X                wclear(mn);
  1203. X                return(0);
  1204. X            case 15:        /* Clear all chars */
  1205. X                mvwaddstr(mn, 12, 0, "Are you sure? ");
  1206. X                wrefresh(mn);
  1207. X                cur = mn; xp = 15; yp = 12;
  1208. X                noecho();
  1209. X                crmode();
  1210. X                if (wgetch(mn) == 'y') {
  1211. X                    for (i = 0; i < 3; i++)
  1212. X                        dosort[i].wch = 0;
  1213. X                }
  1214. X                gtot = -1;
  1215. X                wmove(mn, 12, 0); wclrtoeol(mn);
  1216. X                wrefresh(mn);
  1217. X                goto lop1;
  1218. X            default:
  1219. X                if (n < 1 || n > 15)
  1220. X                    goto lop2;
  1221. X                else
  1222. X                    break;
  1223. X        }
  1224. X        curn = whichone();
  1225. X        if (dosort[0].wch == n || dosort[1].wch == n || dosort[2].wch == n) {
  1226. X            bot("This characteristic is already being sorted.");
  1227. X            sleep(3);
  1228. X            bot(" ");
  1229. X            mvwaddstr(btm, 0, 0, "Do you wish to change this characteristic? ");
  1230. X            wrefresh(btm);
  1231. X            cur = btm; xp = 44; yp = 0;
  1232. X            noecho(); crmode();
  1233. X            if (getchar() == 'y') {
  1234. X                bot(" ");
  1235. X                for (i = 0; i < 2; i++) {
  1236. X                    if (dosort[i].wch == n)
  1237. X                        curn = i;
  1238. X                }
  1239. X                goto lop3;
  1240. X            } else if (curn != 3) {
  1241. X                mvwaddstr(btm, 0, 0, "Do you wish to make another characteristic of the same type? ");
  1242. X                wrefresh(btm);
  1243. X                cur = btm; xp = 62; yp = 0;
  1244. X                noecho(); crmode();
  1245. X                if (getchar() != 'y') {
  1246. X                    wclear(btm); wrefresh(btm);
  1247. X                    goto lop2;
  1248. X                }
  1249. X                wclear(btm); wrefresh(btm);
  1250. X            }
  1251. X        }
  1252. X        if (curn > 2) {
  1253. X            bot("Maximum of three sorting characteristics");
  1254. X            sleep(3);
  1255. X            bot(" ");
  1256. X            goto lop2;
  1257. X        }
  1258. Xlop3:        dosort[curn].wch = n;
  1259. X        wclear(mn); wrefresh(mn);
  1260. X        wmove(mn, 1, 0);
  1261. X        wprintw(mn, "You would like to select some elements with their '%s' being", sopts[n].chst);
  1262. X        mvwaddstr(mn, 3, 0, "1] Equal To");
  1263. X        wmove(mn, 4, 0); wprintw(mn, "2] %s", sopts[n].upline);
  1264. X        wmove(mn, 5, 0); wprintw(mn, "3] %s", sopts[n].dnline);
  1265. X        wmove(mn, 6, 0);
  1266. X        wprintw(mn, "4] Close To (+/- %1.*f)", sopts[n].dnum, closev[n]);
  1267. X        wmove(mn, 7, 0); wprintw(mn, "5] Exit (will erase characteristic)");
  1268. Xlop4:        mvwaddstr(mn, 11, 0, "Your Choice? ");
  1269. X        wrefresh(mn);
  1270. X        cur = mn; xp = 14; yp = 11;
  1271. X        noecho();
  1272. X        crmode();
  1273. X        switch(wgetch(mn)) {
  1274. X            case '?': help(20); goto lop4;
  1275. X            case '1': wprintw(mn, "Equal To"); dosort[curn].sgn = EQUAL;    break;
  1276. X            case '2': wprintw(mn, "Greater Than"); dosort[curn].sgn = GREATER;    break;
  1277. X            case '3': wprintw(mn, "Less Than"); dosort[curn].sgn = LESS;    break;
  1278. X            case '4': wprintw(mn, "Close To"); dosort[curn].sgn = CLOSE;    break;
  1279. X            case '5': dosort[curn].wch = 0;
  1280. X                  if (curn == 1) {
  1281. X                    if (dosort[2].wch != 0) {
  1282. X                        dosort[1].wch = dosort[2].wch;
  1283. X                        dosort[1].sgn = dosort[2].sgn;
  1284. X                        dosort[1].amt = dosort[2].amt;
  1285. X                        dosort[2].wch = 0;
  1286. X                    }
  1287. X                  } else if (curn == 0) {
  1288. X                    if (dosort[1].wch != 0) {
  1289. X                        dosort[0].wch = dosort[1].wch;
  1290. X                        dosort[0].sgn = dosort[1].sgn;
  1291. X                        dosort[0].amt = dosort[1].amt;
  1292. X                        dosort[1].wch = 0;
  1293. X                    }
  1294. X                    if (dosort[2].wch != 0) {
  1295. X                        dosort[1].wch = dosort[2].wch;
  1296. X                        dosort[1].sgn = dosort[2].sgn;
  1297. X                        dosort[1].amt = dosort[2].amt;
  1298. X                        dosort[2].wch = 0;
  1299. X                    }
  1300. X                  }
  1301. X                goto lop1;
  1302. X            default:
  1303. X                goto lop4;
  1304. X        }
  1305. Xlop5:        mvwaddstr(mn, 12, 0, "What Value? ");
  1306. X        wclrtoeol(mn);
  1307. X        wrefresh(mn);
  1308. X        cur = mn; xp = 13; yp = 12;
  1309. X        echo();
  1310. X        nocrmode();
  1311. X        scanf("%f", &dosort[curn].amt);
  1312. X        if (dosort[curn].amt > 9999) {
  1313. X            bot("Maximum amount is 9999.");
  1314. X            sleep(2);
  1315. X            bot(" ");
  1316. X            goto lop5;
  1317. X        }
  1318. X        getchar();        /* Eat the \n that scanf doesn't */
  1319. X    }
  1320. X}
  1321. END_OF_FILE
  1322.   if test 6207 -ne `wc -c <'schar.c'`; then
  1323.     echo shar: \"'schar.c'\" unpacked with wrong size!
  1324.   fi
  1325.   # end of 'schar.c'
  1326. fi
  1327. if test -f 'scrmisc.c' -a "${1}" != "-c" ; then 
  1328.   echo shar: Will not clobber existing file \"'scrmisc.c'\"
  1329. else
  1330.   echo shar: Extracting \"'scrmisc.c'\" \(5067 characters\)
  1331.   sed "s/^X//" >'scrmisc.c' <<'END_OF_FILE'
  1332. X/*
  1333. X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
  1334. X *
  1335. X * scrmisc.c    Collection of curses screen misc stuff
  1336. X */
  1337. X
  1338. X#include <curses.h>
  1339. X#include "variables.h"
  1340. X#include "windows.h"
  1341. X
  1342. X/* The SPACING define is for spacing the transcripts.  This spacing technique
  1343. X * will USUALLY work for most print queues WITHOUT end-of-page form-feeding,
  1344. X * meaning the print command doesn't care about upper and lower margins.  If
  1345. X * so, a lower value may be needed. */
  1346. X#define    SPACING        4
  1347. X
  1348. Xmenu(str)
  1349. Xchar    *str;
  1350. X{
  1351. X    wstandout(mn);
  1352. X    mvwaddstr(mn, 0, (40 - (strlen(str) / 2)), str);
  1353. X    wstandend(mn);
  1354. X    wrefresh(mn);
  1355. X}
  1356. X
  1357. X/*
  1358. X * bot(str)
  1359. X *    input:    str - char - string to print on bottom
  1360. X *    output: curses only
  1361. X *
  1362. X * purpose:    Take ''str'' and put it on ''btm'' (window)
  1363. X */
  1364. Xbot(strn)
  1365. Xchar    *strn;
  1366. X{
  1367. X    wclear(btm); mvwaddstr(btm, 0, 0, strn); wrefresh(btm);
  1368. X}
  1369. X
  1370. X/*
  1371. X * spc() - no input
  1372. X *
  1373. X * purpose:    To prompt the user that there is more..
  1374. X */
  1375. Xspc()
  1376. X{
  1377. X    wclear(btm); mvwaddstr(btm, 0, 0, "<< Press SPACE BAR to continue >>");
  1378. X    wrefresh(btm);
  1379. X    cur = btm; xp = 33; yp = 1;
  1380. X    noecho(); crmode();
  1381. X    getchar();
  1382. X    wclear(btm);
  1383. X    wrefresh(btm);
  1384. X}
  1385. X
  1386. Xint    needsit(win)
  1387. XWINDOW    *win;
  1388. X{
  1389. X    int    y, x;
  1390. X
  1391. X    for (y = 0; y < win->_maxy; y++) {
  1392. X        for (x = 0; x < win->_maxx; x++)
  1393. X            if (mvwinch(win, y, x) != ' ')
  1394. X                return(1);
  1395. X    }
  1396. X    return(0);
  1397. X}
  1398. X
  1399. Xvoid    help(num)
  1400. Xint    num;
  1401. X{
  1402. X    FILE    *fp;
  1403. X    char    str[60];
  1404. X    int    line, i;
  1405. X
  1406. X    hlp = newwin(16, 62, 4, 8);
  1407. X    wrefresh(hlp);
  1408. X
  1409. X    if ((fp = fopen(HELPFILE, "r")) == NULL) {
  1410. X        mvwaddstr(hlp, 7, 1, "The HELPFILE is not available.");
  1411. X        mvwaddstr(hlp, 8, 1, "Contact a chemtab administrator.");
  1412. X        sleep(5);
  1413. X        delwin(hlp);
  1414. X        goto clean;
  1415. X    }
  1416. X
  1417. X    line = 0;
  1418. X    for (;;) {
  1419. X        fgets(str, 60, fp);
  1420. X        if (str[0] == '_')
  1421. X            if (++line == num)
  1422. X                break;
  1423. X    }
  1424. X
  1425. X    for (i = 1; i < 15; i++) {
  1426. X        if (fgets(str, 60, fp) == NULL) break;
  1427. X        if (str[0] == '_') break;
  1428. X        mvwaddstr(hlp, i, 2, str);
  1429. X    }
  1430. X
  1431. X    box(hlp, '|', '-');
  1432. Xclean:    wstandout(hlp); mvwaddstr(hlp, 15, 15, "Press <<RETURN>> to continue...");
  1433. X    wrefresh(hlp);
  1434. X    wstandend(hlp);
  1435. X    cur = hlp; xp = 46; yp = 15;
  1436. X    noecho();
  1437. X    gets(str);
  1438. X    wclear(hlp); wrefresh(hlp);
  1439. X    delwin(hlp);
  1440. X    hlp = NULL;
  1441. X    if (needsit(stdscr)) { touchwin(stdscr); wrefresh(stdscr); }
  1442. X    if (needsit(graph)) { touchwin(graph); wrefresh(graph); }
  1443. X    if (needsit(mn)) { touchwin(mn); wrefresh(mn); }
  1444. X    if (needsit(srt)) { touchwin(srt); wrefresh(srt); }
  1445. X    if (needsit(btm)) { touchwin(btm); wrefresh(btm); }
  1446. X}
  1447. X
  1448. Xcapture(win, f, z)
  1449. XWINDOW    *win;
  1450. Xint    f, z;
  1451. X{
  1452. X    char    c;
  1453. X    int    i, j, icn = 0;            /* Internal count */
  1454. X    if (!trans)
  1455. X        return(1);
  1456. X
  1457. X    for (;;) {
  1458. Xl22:        wclear(btm); mvwaddstr(btm, 0, 0, "Would you like this on your transcript? ");
  1459. X        wrefresh(btm);
  1460. X        cur = btm; xp = 41; yp = 0;
  1461. X        noecho(); crmode();
  1462. X        c = wgetch(btm);
  1463. X        if (c == 'y') break;
  1464. X        if (c == '?') { help(22); goto l22; }
  1465. X        else if (c == 'n') return(1);
  1466. X    }
  1467. X            
  1468. X    if (!z) {
  1469. X        for (i = 0; i < SPACING; i++) {
  1470. X            fputc('\n', fp);
  1471. X            icn++;
  1472. X        }
  1473. X    } else {
  1474. X        for (i = 0; i < SPACING-2; i++) {
  1475. X            fputc('\n', fp);
  1476. X            icn++;
  1477. X        }
  1478. X        fprintf(fp, "Your selection characteristics are listed on the next line.\n");
  1479. X        icn++;
  1480. X        for (i = 0; i < 3; i++) {
  1481. X            if (dosort[i].wch != 0) {
  1482. X                icn++;
  1483. X                fprintf(fp, "%s ", sopts[dosort[i].wch].chst);
  1484. X                switch(dosort[i].sgn) {
  1485. X                    case EQUAL: fprintf(fp, "= "); break;
  1486. X                    case GREATER: fprintf(fp, "> "); break;
  1487. X                    case CLOSE: fprintf(fp, "~ "); break;
  1488. X                    default: fprintf(fp, "< ");
  1489. X                }
  1490. X                fprintf(fp, "%4.*f  ", sopts[dosort[i].wch].dnum, dosort[i].amt);
  1491. X            }
  1492. X        }
  1493. X    }
  1494. X    fputc('\n', fp);
  1495. X    for (i = 0; i < 23; i++) {
  1496. X        if (!f)
  1497. X            fprintf(fp, "      ");
  1498. X        for (j = 0; j < 80; j++) {
  1499. X            wmove(graph, i, j);
  1500. X            fputc(winch(graph), fp);
  1501. X        }
  1502. X        fputc('\n', fp);
  1503. X    }
  1504. X    for (i = 0; i < SPACING-2; i++)
  1505. X        fputc('\n', fp);
  1506. X
  1507. X    fflush(fp);
  1508. X    return(1);
  1509. X}
  1510. X
  1511. Xversion()
  1512. X{
  1513. X    clear(); refresh();
  1514. X
  1515. X    standout();
  1516. X    mvaddstr(0, 34, "Chemtab V2.01");
  1517. X    standend();
  1518. X    mvaddstr(2, 0, "Element data (text): ");
  1519. X    printw("%s", PERTABLE);
  1520. X    mvaddstr(3, 0, "Element table (binary): ");
  1521. X    printw("%s", BINTABLE);
  1522. X    mvaddstr(4, 0, "Periodic table (text): ");
  1523. X    printw("%s", TABLE);
  1524. X    mvaddstr(5, 0, "Periodic table (graphic): ");
  1525. X    printw("%s_graphic", TABLE);
  1526. X    mvaddstr(6, 0, "Online help file (text): ");
  1527. X    printw("%s", HELPFILE);
  1528. X    mvaddstr(7, 0, "Close value file (text): ");
  1529. X    printw("%s", CLOSEFILE);
  1530. X    standout();
  1531. X    mvaddstr(9, 0, "The above files must be properly defined for the program to run");
  1532. X    mvaddstr(10, 0, "The files below are optional definitions");
  1533. X    standend();
  1534. X#ifdef    USERSHELL
  1535. X    mvaddstr(12, 0, "Job stopping is enabled.");
  1536. X#else
  1537. X    mvaddstr(12, 0, "Job stopping is disabled.");
  1538. X#endif    USERSHELL
  1539. X
  1540. X#ifdef    PRINTER
  1541. X    mvaddstr(13, 0, "Printing is enabled through the ");
  1542. X    printw("%s ", PRINTER);
  1543. X    printw("command.");
  1544. X#else
  1545. X    mvaddstr(13, 0, "Printing is disabled.");
  1546. X#endif    PRINTER
  1547. X
  1548. X#ifdef    TRANSCRIPT
  1549. X    mvaddstr(14, 0, "User logs are kept in ");
  1550. X    printw("%s.", TRANSCRIPT);
  1551. X#else
  1552. X    mvaddstr(14, 0, "User logs are disabled.");
  1553. X#endif    TRANSCRIPT
  1554. X
  1555. X#ifdef    ReGIS
  1556. X    mvaddstr(15, 0, "ReGIS graphics module is installed.");
  1557. X#else
  1558. X    mvaddstr(15, 0, "ReGIS graphics module is not installed.");
  1559. X#endif    ReGIS
  1560. X
  1561. X    refresh();
  1562. X    spc();
  1563. X    clear(); refresh();
  1564. X}
  1565. END_OF_FILE
  1566.   if test 5067 -ne `wc -c <'scrmisc.c'`; then
  1567.     echo shar: \"'scrmisc.c'\" unpacked with wrong size!
  1568.   fi
  1569.   # end of 'scrmisc.c'
  1570. fi
  1571. if test -f 'tune.h' -a "${1}" != "-c" ; then 
  1572.   echo shar: Will not clobber existing file \"'tune.h'\"
  1573. else
  1574.   echo shar: Extracting \"'tune.h'\" \(2692 characters\)
  1575.   sed "s/^X//" >'tune.h' <<'END_OF_FILE'
  1576. X/*
  1577. X * chemtab - a periodic table data base 1990 Jim King (pulsar@lsrhs)
  1578. X *
  1579. X * tune.h    Site Specifics
  1580. X */
  1581. X
  1582. X/***********
  1583. X *********** DEFINES which MUST be defined.
  1584. X ***********/
  1585. X
  1586. X/* PERTABLE is the path up to and including the list of elements, elist */
  1587. X#define PERTABLE    "/usr/local/lib/chemtab/elist"
  1588. X
  1589. X/* BINTABLE is the binary form (faster to read in) of PERTABLE */
  1590. X#define BINTABLE    "/usr/local/lib/chemtab/binlist"
  1591. X
  1592. X/* TABLE is the path up to and including the periodic table outline, pertab */
  1593. X/* NOTE: the names of the file pertab and pertab_graphic should not be changed.
  1594. X         if you want to change the name change then to name and name_graphic */
  1595. X
  1596. X#define TABLE        "/usr/local/lib/chemtab/pertab"
  1597. X
  1598. X/* HELPFILE is the path up to and including the online helpfile */
  1599. X#define HELPFILE    "/usr/local/lib/chemtab/online_help"
  1600. X
  1601. X/* CLOSEFILE is the filename which contains the close values, meaning if
  1602. X         someone searches for a value 'close to' something, this is the
  1603. X         defined good range to look for. */
  1604. X#define CLOSEFILE    "/usr/local/lib/chemtab/closevalues"
  1605. X
  1606. X/* Now go to scrmisc.c and change the 'SPACING' define.  It is required. */
  1607. X
  1608. X/**********
  1609. X ********** DEFINES which are conditional on IF they are defined.
  1610. X **********/
  1611. X
  1612. X/* If you have a digital LN03 compatible laser printer, define this and
  1613. X   you will be able to print copies of your ReGIS graphs! */
  1614. X#define LASERPRT
  1615. X
  1616. X/* USERSHELL is the command to run if a person tries to stop the program
  1617. X   with a ^Z if you do NOT want the program to stop, comment this out */
  1618. X/* Obviously, this was not written on a SYSV system..  If you have SYSV
  1619. X   it is advised you comment this out */
  1620. X#define USERSHELL    "/bin/csh"
  1621. X
  1622. X/* PRINTER is the printer program or shell script you use to print on
  1623. X   the desired printer for Chemtab output.  Preferably, when using lpr,
  1624. X   you want to add the '-h' function to skip the header page. */
  1625. X/* If you do NOT want to program to print anything out at the end of the
  1626. X   transcript section, do NOT define this.  If it is defined, the printouts
  1627. X   will automagically be printed with this command */
  1628. X/* With PRINTER, an optional define is PRINTQ.  If you have multiple
  1629. X   printers or print queues, the program will prompt you for one to print
  1630. X   to.  Make sure if a space is necessary to use it.. i.e.:
  1631. X
  1632. X   #define PRINTER    "lpr h -P"
  1633. X   #define PRINTQ
  1634. X
  1635. X   #define PRINTER    "prvms -q "
  1636. X   #define PRINTQ            note you need a space */
  1637. X/* ------------------------------------------------------------- */
  1638. X#define PRINTER        "prvms -q "
  1639. X#define    PRINTQ
  1640. X
  1641. X/* TRANSCRIPT is the path to the logfile which lists who uses the program.
  1642. X              if it is not defined, then no log is made. */
  1643. X#define TRANSCRIPT    "logfile"
  1644. END_OF_FILE
  1645.   if test 2692 -ne `wc -c <'tune.h'`; then
  1646.     echo shar: \"'tune.h'\" unpacked with wrong size!
  1647.   fi
  1648.   # end of 'tune.h'
  1649. fi
  1650. if test -f 'variables.h' -a "${1}" != "-c" ; then 
  1651.   echo shar: Will not clobber existing file \"'variables.h'\"
  1652. else
  1653.   echo shar: Extracting \"'variables.h'\" \(2397 characters\)
  1654.   sed "s/^X//" >'variables.h' <<'END_OF_FILE'
  1655. X/*
  1656. X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
  1657. X *
  1658. X * variables.h    Include file - basically a global file
  1659. X */
  1660. X
  1661. X#include <stdio.h>
  1662. X#include "tune.h"
  1663. X
  1664. Xfloat    x;                /* global find() element */
  1665. Xint    sub1[120],            /* Sorted elements stored here */
  1666. X    xp, yp,                /* Stop job handling */
  1667. X#ifdef    LASERPRT
  1668. X    laser,                /* Laser print? */
  1669. X#endif    LASERPRT
  1670. X#ifdef  ReGIS
  1671. X    regis,                /* regis on/off flag */
  1672. X#endif     ReGIS
  1673. X#ifdef    TRANSCRIPT
  1674. X    trans,                /* transcript flag */
  1675. X#endif  TRANSCRIPT
  1676. X    gtot;                /* total of sorted elements */
  1677. X#ifdef    LASERPRT
  1678. XFILE    *lsr;
  1679. X#endif    LASERPRT
  1680. XFILE    *fp;                /* File pointer for the above flag */
  1681. X
  1682. Xchar    lnm[80];            /* User's last name for transcript */
  1683. X
  1684. Xstruct dung {                /* Sorting structure */
  1685. X    int    wch,
  1686. X        sgn;
  1687. X    float    amt;
  1688. X} dosort[3];
  1689. X
  1690. Xstatic char    *mopts[] = {        /* Main menu options */
  1691. X    0,
  1692. X    "List information regarding one element",
  1693. X    "Choose element's characteristics",
  1694. X    "List information on all selected elements",
  1695. X    "View periodic table showing positions of selected elements",
  1696. X    "Use the graphing module",
  1697. X    "Save your transcripts, Print them, and Quit",
  1698. X    0
  1699. X};
  1700. X
  1701. X/* If you are looking here because you want to change the 'close values'
  1702. X * and you do not understand the abbreviations in 'closevalues' then
  1703. X * the following list is in order (note the first element is
  1704. X        "0",            "0",        "0",        0,
  1705. X * which means that the first value in the closevalues is 0
  1706. X */
  1707. X
  1708. Xstatic struct op {
  1709. X    char    chst[30],
  1710. X        upline[20],
  1711. X        dnline[20];
  1712. X    int    dnum;
  1713. X} sopts[] = {            /* Selecting options */
  1714. X    "0",            "0",        "0",        0,
  1715. X    "Atomic Number",    "Greater Than",    "Less Than",    0,
  1716. X    "Atomic Mass",        "Greater Than",    "Less Than",    3,
  1717. X    "Family (going up-dn)",    "Greater Than",    "Less Than",    0,
  1718. X    "Row (going left-rt)",    "Greater Than",    "Less Than",    0,
  1719. X    "Valence Electrons",    "More Than",    "Less Than",    0,
  1720. X    "Melting Temperature",    "Greater Than",    "Less Than",    0,
  1721. X    "Boiling Temperature",    "Greater Than",    "Less Than",    0,
  1722. X    "Ionization Energy",    "Greater Than",    "Less Than",    0,
  1723. X    "Discovery Year",    "After",    "Before",    0,
  1724. X    "Electronegativity",    "Greater Than",    "Less Than",    1,
  1725. X    "Specific Heat",    "Greater Than",    "Less Than",    3,
  1726. X    "Density",        "Greater Than",    "Less Than",    2,
  1727. X    "Atomic Radius",    "Greater Than",    "Smaller Than",    2,
  1728. X    "Return to Main Menu",    "0",        "0",        0,
  1729. X    "Clear ALL Characteristics",    "0",    "0",        0,
  1730. X    "0",            "0",        "0",        0
  1731. X};
  1732. X
  1733. X#define    EQUAL    0        /* Constants */
  1734. X#define GREATER    1
  1735. X#define LESS    2
  1736. X#define    CLOSE    3
  1737. END_OF_FILE
  1738.   if test 2397 -ne `wc -c <'variables.h'`; then
  1739.     echo shar: \"'variables.h'\" unpacked with wrong size!
  1740.   fi
  1741.   # end of 'variables.h'
  1742. fi
  1743. if test -f 'vdata.c' -a "${1}" != "-c" ; then 
  1744.   echo shar: Will not clobber existing file \"'vdata.c'\"
  1745. else
  1746.   echo shar: Extracting \"'vdata.c'\" \(4062 characters\)
  1747.   sed "s/^X//" >'vdata.c' <<'END_OF_FILE'
  1748. X/*
  1749. X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
  1750. X *
  1751. X * vdata.c    View current data
  1752. X */
  1753. X
  1754. X#include <stdio.h>
  1755. X#include <curses.h>
  1756. X#include "variables.h"
  1757. X#include "tune.h"
  1758. X#include "element.h"
  1759. X#include "windows.h"
  1760. X#include "undefs.h"
  1761. X
  1762. X/*
  1763. X * topline() - no input
  1764. X *
  1765. X * purpose:    sets up the topline of user info.
  1766. X */
  1767. Xtopline()
  1768. X{
  1769. X    mvwaddstr(graph, 0, 0, "Name");
  1770. X    mvwaddstr(graph, 0, 13, "Sy");
  1771. X    mvwaddstr(graph, 0, 18, "Z");
  1772. X    mvwaddstr(graph, 0, 23, "MASS");
  1773. X    mvwaddstr(graph, 0, 30, "FM");
  1774. X    mvwaddstr(graph, 0, 33, "R");
  1775. X    mvwaddstr(graph, 0, 35, "V");
  1776. X    mvwaddstr(graph, 0, 37, "Melt");
  1777. X    mvwaddstr(graph, 0, 42, "Boil");
  1778. X    mvwaddstr(graph, 0, 47, "FIO");
  1779. X    mvwaddstr(graph, 0, 51, "Year");
  1780. X    mvwaddstr(graph, 0, 56, "ENG");
  1781. X    mvwaddstr(graph, 0, 60, "SPHT");
  1782. X    mvwaddstr(graph, 0, 66, "DENS");
  1783. X    mvwaddstr(graph, 0, 71, "ARAD");
  1784. X    wrefresh(graph);
  1785. X}
  1786. X
  1787. X/*
  1788. X * vdata() - no input
  1789. X *
  1790. X * purpose:    show all information on all selected elements to user
  1791. X */
  1792. Xvdata()
  1793. X{
  1794. X    struct elem *tmp;
  1795. X    int    n = 0, flg = 0, factor = 1, l, m, i, j, sorted;
  1796. X
  1797. X    if (gtot == -1) {
  1798. X        mvwaddstr(mn, 15, 0, "Please choose some selection characteristics before you do this.");
  1799. X        wrefresh(mn);
  1800. X        sleep(2);
  1801. X        wmove(mn, 15, 0); wclrtoeol(mn);
  1802. X        return(0);
  1803. X    }
  1804. X
  1805. X    wclear(mn);
  1806. X    wrefresh(mn);
  1807. X
  1808. X    wclear(graph);
  1809. X    wrefresh(graph);
  1810. X    if (gtot == 0) {
  1811. X        mvwaddstr(graph, 5, 0, "No elements met the requirements you set.");
  1812. X        wrefresh(graph);
  1813. X        spc();
  1814. X        clear();
  1815. X        refresh();
  1816. X        return(0);
  1817. X    }
  1818. X    if (gtot > 22)
  1819. X        factor++;
  1820. X    if (gtot > 44)
  1821. X        factor++;
  1822. X    if (gtot > 66)
  1823. X        factor++;
  1824. X    if (gtot > 88)
  1825. X        factor++;
  1826. X    clear();
  1827. X    refresh();
  1828. X    for (i = 0; i < factor; i++) {
  1829. X        topline();
  1830. X        for (j = 22*i+1; j < 22*i+23; j++) {
  1831. X            if (j > gtot)
  1832. X                break;
  1833. X            n = sub1[j];
  1834. X            for (tmp = e; n != tmp->anum; tmp = tmp->next) ;
  1835. X            mvwaddstr(graph, j-22*i, 0, tmp->name);
  1836. X            wmove(graph, j-22*i, 13); wprintw(graph, "%s", tmp->sym);
  1837. X            wmove(graph, j-22*i, 18); wprintw(graph, "%-d", tmp->anum);
  1838. X            wmove(graph, j-22*i, 22); wprintw(graph, "%-3.3f", tmp->amass);
  1839. X            wmove(graph, j-22*i, 30); wprintw(graph, "%-d", tmp->fam);
  1840. X            wmove(graph, j-22*i, 33); wprintw(graph, "%-d", tmp->row);
  1841. X            if (tmp->val == VAL) {
  1842. X                wstandout(graph);
  1843. X                mvwaddstr(graph, j-22*1, 35, "X");
  1844. X                wstandend(graph);
  1845. X            } else {
  1846. X                wmove(graph, j-22*i, 35); wprintw(graph, "%d", tmp->val);
  1847. X            }
  1848. X            if (tmp->melt == MEL) {
  1849. X                wstandout(graph);
  1850. X                mvwaddstr(graph, j-22*i, 37, "N/F");
  1851. X                wstandend(graph);
  1852. X            } else {
  1853. X                wmove(graph, j-22*i, 37); wprintw(graph, "%-d", tmp->melt);
  1854. X            }
  1855. X            if (tmp->boil == BOI) {
  1856. X                wstandout(graph);
  1857. X                mvwaddstr(graph, j-22*i, 42, "N/F");
  1858. X                wstandend(graph);
  1859. X            } else {
  1860. X                wmove(graph, j-22*i, 42); wprintw(graph, "%-d", tmp->boil);
  1861. X            }
  1862. X            if (tmp->fio == FIO) {
  1863. X                wstandout(graph);
  1864. X                mvwaddstr(graph, j-22*i, 47, "N/F");
  1865. X                wstandend(graph);
  1866. X            } else {
  1867. X                wmove(graph, j-22*i, 47); wprintw(graph, "%3d", tmp->fio);
  1868. X            }
  1869. X            if (tmp->year == YEA) {
  1870. X                wstandout(graph);
  1871. X                mvwaddstr(graph, j-22*i, 51, "B.C.");
  1872. X                wstandend(graph);
  1873. X            } else {
  1874. X                wmove(graph, j-22*i, 51); wprintw(graph, "%-d", tmp->year);
  1875. X            }
  1876. X            if (tmp->eneg == ENG) {
  1877. X                wstandout(graph);
  1878. X                mvwaddstr(graph, j-22*i, 56, "N/F");
  1879. X                wstandend(graph);
  1880. X            } else {
  1881. X                wmove(graph, j-22*i, 56); wprintw(graph, "%1.1f", tmp->eneg);
  1882. X            }
  1883. X            if (tmp->spht == SPHT) {
  1884. X                wstandout(graph);
  1885. X                mvwaddstr(graph, j-22*i, 60, "N/F");
  1886. X                wstandend(graph);
  1887. X            } else {
  1888. X                wmove(graph, j-22*i, 60); wprintw(graph, "%1.3f", tmp->spht);
  1889. X            }
  1890. X            if (tmp->dens == DENS) {
  1891. X                wstandout(graph);
  1892. X                mvwaddstr(graph, j-22*i, 66, "N/F");
  1893. X                wstandend(graph);
  1894. X            } else {
  1895. X                wmove(graph, j-22*i, 66);
  1896. X                if (tmp->dens > 9.99)
  1897. X                    wprintw(graph, "%2.1f", tmp->dens);
  1898. X                else
  1899. X                    wprintw(graph, "%1.2f", tmp->dens);
  1900. X            }
  1901. X            if (tmp->arad == ARD) {
  1902. X                wstandout(graph);
  1903. X                mvwaddstr(graph, j-22*i, 71, "N/F");
  1904. X                wstandend(graph);
  1905. X            } else {
  1906. X                wmove(graph, j-22*i, 71); wprintw(graph, "%1.2f", tmp->arad);
  1907. X            }
  1908. X            wrefresh(graph);
  1909. X        }
  1910. X        spc();
  1911. X        capture(graph, 0, 1);
  1912. X        wclear(graph);
  1913. X    }
  1914. X    clear();
  1915. X    refresh();
  1916. X    return(0);
  1917. X}
  1918. END_OF_FILE
  1919.   if test 4062 -ne `wc -c <'vdata.c'`; then
  1920.     echo shar: \"'vdata.c'\" unpacked with wrong size!
  1921.   fi
  1922.   # end of 'vdata.c'
  1923. fi
  1924. echo shar: End of archive 2 \(of 3\).
  1925. cp /dev/null ark2isdone
  1926. MISSING=""
  1927. for I in 1 2 3 ; do
  1928.     if test ! -f ark${I}isdone ; then
  1929.     MISSING="${MISSING} ${I}"
  1930.     fi
  1931. done
  1932. if test "${MISSING}" = "" ; then
  1933.     echo You have unpacked all 3 archives.
  1934.     rm -f ark[1-9]isdone
  1935. else
  1936.     echo You still must unpack the following archives:
  1937.     echo "        " ${MISSING}
  1938. fi
  1939. exit 0
  1940. exit 0 # Just in case...
  1941.